/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrateur
 */
@Entity
@Table(name = "etat_commande")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EtatCommande.findAll", query = "SELECT e FROM EtatCommande e"),
    @NamedQuery(name = "EtatCommande.findByIdetatCommande", query = "SELECT e FROM EtatCommande e WHERE e.idetatCommande = :idetatCommande"),
    @NamedQuery(name = "EtatCommande.findByIdUnEtat", query = "SELECT e FROM EtatCommande e WHERE e.idUnEtat = :idUnEtat"),
    @NamedQuery(name = "EtatCommande.findByDescription", query = "SELECT e FROM EtatCommande e WHERE e.description = :description")})
public class EtatCommande implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Column(name = "idetat_commande")
    private int idetatCommande;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_un_etat")
    private Integer idUnEtat;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "description")
    private String description;
    @JoinColumn(name = "idlangue", referencedColumnName = "idlangue")
    @ManyToOne(optional = false)
    private Langue idlangue;

    public EtatCommande() {
    }

    public EtatCommande(Integer idUnEtat) {
        this.idUnEtat = idUnEtat;
    }

    public EtatCommande(Integer idUnEtat, int idetatCommande, String description) {
        this.idUnEtat = idUnEtat;
        this.idetatCommande = idetatCommande;
        this.description = description;
    }

    public int getIdetatCommande() {
        return idetatCommande;
    }

    public void setIdetatCommande(int idetatCommande) {
        this.idetatCommande = idetatCommande;
    }

    public Integer getIdUnEtat() {
        return idUnEtat;
    }

    public void setIdUnEtat(Integer idUnEtat) {
        this.idUnEtat = idUnEtat;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Langue getIdlangue() {
        return idlangue;
    }

    public void setIdlangue(Langue idlangue) {
        this.idlangue = idlangue;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUnEtat != null ? idUnEtat.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EtatCommande)) {
            return false;
        }
        EtatCommande other = (EtatCommande) object;
        if ((this.idUnEtat == null && other.idUnEtat != null) || (this.idUnEtat != null && !this.idUnEtat.equals(other.idUnEtat))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.EtatCommande[ idUnEtat=" + idUnEtat + " ]";
    }
    
}
